<#assign ctx=springMacroRequestContext.contextPath />
<#include "/macro/publicMacro.ftl">
<#import "/macro/pagination.ftl" as Pagination>
<#import "/macro/FormItem.ftl" as Form>

<@header title="用户编辑">
    <link href="${ctx}/resource/frame/datetimepicker/jquery.datetimepicker.min.css" rel="stylesheet">
</@header>

<@body>
<h2 class="module-title">用户编辑</h2>

<div class="alert alert-primary" role="alert">
    <button class="btn btn-info" onclick="javascript: history.back(-1);return false;" >返回</button>
</div>

<form class="form-horizontal" id="imUserForm" action="${ctx}/imUser/save" method="post">
    <input type="hidden" name="id" value="${imUser.id}"/>
    <@Form.FormItem name="code" label="登录码">
        <input type="text" class="form-control" name="code" id="code" aria-describedby="登录码" value="${imUser.code}">
    </@Form.FormItem>
    <@Form.FormItem name="userName" label="用户名">
        <input type="text" class="form-control" name="userName" id="userName" aria-describedby="用户名" value="${imUser.userName}">
    </@Form.FormItem>
    <@Form.FormItem name="password" label="登录密码">
        <input type="text" class="form-control" name="password" id="password" aria-describedby="登录密码" value="${imUser.password}">
    </@Form.FormItem>
    <@Form.FormItem name="terminalTypes" label="登录终端">
        <input type="text" class="form-control" name="terminalTypes" id="terminalTypes" aria-describedby="登录终端" value="${imUser.terminalTypes}">
    </@Form.FormItem>
    <@Form.FormItem name="tenantCode" label="租户id">
        <input type="text" class="form-control" name="tenantCode" id="tenantCode" aria-describedby="租户id" value="${imUser.tenantCode}">
    </@Form.FormItem>
    <@Form.FormItem name="departmentCode" label="部门编码">
        <input type="text" class="form-control" name="departmentCode" id="departmentCode" aria-describedby="部门编码" value="${imUser.departmentCode}">
    </@Form.FormItem>
    <@Form.FormItem name="mobile" label="手机号">
        <input type="text" class="form-control" name="mobile" id="mobile" aria-describedby="手机号" value="${imUser.mobile}">
    </@Form.FormItem>
    <@Form.FormItem name="headImg" label="头像">
        <input type="text" class="form-control" name="headImg" id="headImg" aria-describedby="头像" value="${imUser.headImg}">
    </@Form.FormItem>
    <@Form.FormItem name="motto" label="座右铭">
        <input type="text" class="form-control" name="motto" id="motto" aria-describedby="座右铭" value="${imUser.motto}">
    </@Form.FormItem>
    <@Form.FormItem name="sex" label="性别">
        <input type="text" class="form-control" name="sex" id="sex" aria-describedby="性别" value="${imUser.sex}">
    </@Form.FormItem>
    <@Form.FormItem name="enable" label="是否可用">
        <input type="text" class="form-control" name="enable" id="enable" aria-describedby="是否可用" value="${imUser.enable}">
    </@Form.FormItem>
    <@Form.FormItem name="token" label="无密盾牌">
        <input type="text" class="form-control" name="token" id="token" aria-describedby="无密盾牌" value="${imUser.token}">
    </@Form.FormItem>
    <@Form.FormItem name="refreshToken" label="刷新盾牌">
        <input type="text" class="form-control" name="refreshToken" id="refreshToken" aria-describedby="刷新盾牌" value="${imUser.refreshToken}">
    </@Form.FormItem>
    <@Form.FormItem name="loginTime" label="上次登录时间">
        <div class='input-group date' id='loginTime1'>
            <input type="text" class="form-control" name="loginTime" id="loginTime" aria-describedby="上次登录时间" value="${(imUser.loginTime?string('yyyy-MM-dd hh:mm:ss'))!}">
            <span class="input-group-addon">
                <span class="glyphicon glyphicon-calendar"></span>
            </span>
        </div>
    </@Form.FormItem>
    <@Form.FormItem name="loginErrorNum" label="登录失败次数">
        <input type="text" class="form-control" name="loginErrorNum" id="loginErrorNum" aria-describedby="登录失败次数" value="${imUser.loginErrorNum}">
    </@Form.FormItem>
    <@Form.FormItem name="lockTime" label="锁定时间">
        <div class='input-group date' id='lockTime1'>
            <input type="text" class="form-control" name="lockTime" id="lockTime" aria-describedby="锁定时间" value="${(imUser.lockTime?string('yyyy-MM-dd hh:mm:ss'))!}">
            <span class="input-group-addon">
                <span class="glyphicon glyphicon-calendar"></span>
            </span>
        </div>
    </@Form.FormItem>
    <@Form.FormItem name="createTime" label="">
        <div class='input-group date' id='createTime1'>
            <input type="text" class="form-control" name="createTime" id="createTime" aria-describedby="" value="${(imUser.createTime?string('yyyy-MM-dd hh:mm:ss'))!}">
            <span class="input-group-addon">
                <span class="glyphicon glyphicon-calendar"></span>
            </span>
        </div>
    </@Form.FormItem>
    <@Form.FormItem name="updateTime" label="更新时间">
        <div class='input-group date' id='updateTime1'>
            <input type="text" class="form-control" name="updateTime" id="updateTime" aria-describedby="更新时间" value="${(imUser.updateTime?string('yyyy-MM-dd hh:mm:ss'))!}">
            <span class="input-group-addon">
                <span class="glyphicon glyphicon-calendar"></span>
            </span>
        </div>
    </@Form.FormItem>
    <@Form.FormItem name="clientUpdateTime" label="">
        <div class='input-group date' id='clientUpdateTime1'>
            <input type="text" class="form-control" name="clientUpdateTime" id="clientUpdateTime" aria-describedby="" value="${(imUser.clientUpdateTime?string('yyyy-MM-dd hh:mm:ss'))!}">
            <span class="input-group-addon">
                <span class="glyphicon glyphicon-calendar"></span>
            </span>
        </div>
    </@Form.FormItem>
    <div class="form-group">
        <div class="col-sm-offset-2 col-sm-10">
            <button type="submit" class="btn btn-primary">提交</button>
        </div>
    </div>
</form>
</@body>

<@footer>
    <script src="${ctx}/resource/frame/datetimepicker/jquery.datetimepicker.full.min.js"></script>
    <script src="${ctx}/resource/common/js/jquery.validate.min.js"></script>

    <script type="text/javascript">
        $(function () {
            $('#loginTime').datetimepicker({
                format:'Y-m-d H:i:s',
                lang:'zh'});
            $('#lockTime').datetimepicker({
                format:'Y-m-d H:i:s',
                lang:'zh'});
            $('#createTime').datetimepicker({
                format:'Y-m-d H:i:s',
                lang:'zh'});
            $('#updateTime').datetimepicker({
                format:'Y-m-d H:i:s',
                lang:'zh'});
            $('#clientUpdateTime').datetimepicker({
                format:'Y-m-d H:i:s',
                lang:'zh'});
        });

        $().ready(function() {
            $("#imUserForm").validate({
                rules: {
                    id: {
                        required: true,
                        digits: true
                    },
                    code: "required" ,
                    userName: "required" ,
                    password: "required" ,
                    terminalTypes: "required" ,
                    tenantCode: "required" ,
                   departmentCode: {
                      maxlength: 24
                   },
                   mobile: {
                      maxlength: 15
                   },
                   headImg: {
                      maxlength: 256
                   },
                   motto: {
                      maxlength: 516
                   },
                   sex: "required" ,
                    enable: {
                        required: true,
                        digits: true
                    },
                   token: {
                      maxlength: 2,048
                   },
                   refreshToken: {
                      maxlength: 2,048
                   },
                   loginTime: {
                      maxlength: 26
                   },
                   loginErrorNum: "required" ,
                   lockTime: {
                      maxlength: 26
                   },
                    createTime: {
                        required: true,
                        date: true
                    },
                    updateTime: {
                        required: true,
                        date: true
                    },
                   clientUpdateTime: {
                      maxlength: 26
                   }
                }
            });
        });
    </script>
</@footer>